package com.emeraldparser.util;

import java.util.Collection;
import java.util.Set;

public class Collections3 {

	/**
	 * Returns a Set, guaranteeing that every unique elements from collection appears only once.
	 * 
	 * @param <E>
	 * @param collection
	 * @return
	 */
	public static <E> Set<E> set(final Collection<E> collection) {
		return new CollectionBasedSet<E>() {

			@Override
			protected Collection<E> collection() {
				return collection;
			}

		};
	}

}
